<include file="Public/header" />

</head>
<body>
    <div class="page-group">
        <div class="page page-current">
           <header class="bar bar-nav">
    <a class="button button-link button-nav pull-left back" href="javascript:window.history.go(-1)">
      <span class="icon icon-left"></span>
    </a>
    <h1 class="title">在线预约</h1>
    <a class="button button-link button-nav pull-right" href="/">
                <span class="icon icon-home"></span>
    </a>
</header>
            <div class="content ">
                <form class="infomat" action='{:U('AppointmentOrder/order')}' method='post'>
                	<div class="ds-title title-new">
                		预约学车订单
                	</div>
                <div class="automated">
                	<div class="coaching-information">
							<img src="{$coach['img']}"/>
							<p>教练姓名：{$coach['coach_name']} 手机：{$coach['phone']}</p>
							<span>场地：{$coach['site']}&nbsp;
							科目：<if condition="$coach['course'] eq 2">科目三</if>
							<if condition="$coach['course'] eq 1">科目二</if>
							&nbsp;车牌号：{$coach['car_num']}&nbsp;车型：{$coach['type']}&nbsp;
							练习类别：<if condition="$coach['category'] eq 1">普通</if>
							<if condition="$coach['category'] eq 2">模拟</if>
							</span>
					</div>
					<p style="text-align: center;">时间段：{$date['time']|date='Y-m-d',###}&nbsp;{$date['s_time']}</p>
					<div>
						<input type="hidden" name='id' value="{$date['id']}" />
						<input type="hidden" name='coach_id' value="{$coach['coach_id']}" />
						<input type="hidden" name='coach_name' value="{$coach['coach_name']}" />
						<input type="hidden" name='coach_head' value="{$coach['img']}" />
						<input type="hidden" name='school_id' value="{$coach['school_id']}" />
						<input type="hidden" name='coach_phone' value="{$coach['phone']}" />
						<input type="hidden" name='site' value="{$coach['site']}" />
						<input type="hidden" name='course' value="{$coach['course']}" />
						<input type="hidden" name='category' value="{$coach['category']}" />
						<input type="hidden" name='car_num' value="{$coach['car_num']}" />
						<input type="hidden" name='type' value="{$coach['type']}" />
						<input type="hidden" name='day' value="{$date['time']}" />
						<input type="hidden" name='time' value="{$date['s_time']}" />
						<input type="hidden" name='time_id' value="{$date['app_time_id']}" />
					</div>
                	<div class="basic">
                		<p>姓名<i>*</i></p>
                		<input type="text" name='user_name' id='user_name' placeholder="请输入姓名"/><i class="icon icon-me i-fr"></i>
                		<p>费用<i>*</i></p>
                		<input type="text" name='price' value="{$date['price']}" disabled='disabled' /><i class="icon icon-cart i-fr"></i>
                		<input type="hidden" name='price' value="{$date['price']}" readonly="readonly" />
                		<p>电话<i>*</i></p>
                		<input type="text" name='user_phone' id='user_phone' placeholder="请输入电话"/><i class="icon icon-phone i-fr"></i>
                	</div>
                	<div class="btns">
                		<button type="submit" class="btn submit">支付订单</button>
                		<button type="reset" class="btn reset">清空信息</button>
                	</div>
                </div>
                </form>
            </div>
        </div>
    </div>

</body>

<include file="Public/footer"/>
<script>

 $(".submit").click(function () {
	 var id=$("input[name='id']").val();
	 var coach_id=$("input[name='coach_id']").val();
	 var coach_name=$("input[name='coach_name']").val();
	 var school_id=$("input[name='school_id']").val();
	 var coach_phone=$("input[name='coach_phone']").val();
	 var site=$("input[name='site']").val();
	 var course=$("input[name='course']").val();
	 var category=$("input[name='category']").val();
	 var car_num=$("input[name='car_num']").val();
	 var type=$("input[name='type']").val();
	 var day=$("input[name='day']").val();
	 var time=$("input[name='time']").val();
	 var time_id=$("input[name='time_id']").val();

	 var user_name=$('#user_name').val(); 
	 var phone =$('#user_phone').val(); 
	 
	 if(user_name == ''){
		 layer.msg('请填写姓名',{time:1000});
         return false;
     }
	 if(phone == ''){
		 layer.msg('请填写手机号',{time:1000});
         return false;
     }
	 if(!phone.match(/^1[34578]\d{9}$/)){
		 layer.msg('手机号格式错误',{time:1000});
         return false;
     }

	 if(id=='' || category =='' || coach_id=='' || coach_name=='' || school_id=='' || coach_phone ==''  || site=='' || course=='' || car_num=='' || type=='' || day=='' || time =='' || time_id==''){
		 layer.msg('参数错误',{time:1000});
		  location.reload();
         return false;
     }
	 

	

}) 


</script>